# _*_ coding : utf-8 _*_
# @Time : 2022/8/13 10:08
# @Author : Moonquake
# @File : 24.自动定位
# @Project : python

from selenium import webdriver
from selenium.webdriver.edge.service import Service
from selenium.webdriver.common.by import By

path=Service("MicrosoftWebDriver.exe")

browser = webdriver.Edge(service=path)

url= 'https://www.baidu.com'

browser.get(url)

# 元素定位

# 根据ID来找对象
# button = browser.find_element(By.ID,'su')

# 根据标签属性值来找对象
#button = browser.find_element(By.NAME,'wd')

# 根据xpath语句来获取对象
# button = browser.find_element(By.XPATH,'//input[@id="su"]')

